<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        p{
            display: none;
        }
    </style>
</head>
<body>

    <div class="tab">
        <div>
            <button>1</button>
            <button>2</button>
            <button>3</button>
        </div>
        <div>
            <p>111</p>
            <p>222</p>
            <p>333</p>
        </div>
    </div>

    <script src="../js/jquery.js"></script>
    <script>

        // jq 极大的封装了js操作  
        
        $('button').click(function() {
            // $(this).css('color' , 'red').siblings().css('color' , 'black');
            // $('p').hide().eq($(this).index()).show()

            $(this).css('color' , 'red').siblings().css('color' , 'black').parent().next().children().hide().eq($(this).index()).show()
        })

    </script>
    
</body>
</html>